<!-- index.html -->

<html>
<head>
    <meta charset="utf-8">
</head>
<body>
<div id="app">
   {{message}}
    <keep-alive>
      <comp1></comp1>
      </keep-alive>
    <!--<router-link to="/comp">組件一</router-link>-->
    <!--<router-link to="/comp2">組件二</router-link>-->
    <!--<router-link :to="{ name: 'comp2', params: { id: 123 }}">组件222</router-link>-->
    <!--<router-view></router-view>-->
<!--    <router-view name="aa"></router-view>
    <router-view name="bb"></router-view>-->
</div>
<script src="bundle.js"></script>
</body>
</html>

<!--
<html>
<head>
    <title>Async Component test</title>
</head>
<body>

<div id="app">
    <router-link to="/home">/home</router-link>
    <router-link to="/about">/about</router-link>
    <router-view></router-view>
</div>

<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
<script>
    function load(componentName, path) {
        return new Promise(function(resolve, reject) {
            var script = document.createElement('script');
            script.src = path;
            script.async = true;
            script.onload = function() {
                var component = Vue.component(componentName);
                if (component) {
                    resolve(component);
                } else {
                    reject();
                }
            };
            script.onerror = reject;
            document.body.appendChild(script);
        });
    }
    var router = new VueRouter({
        routes: [
            {
                path: '/',
                redirect:'/home'
            },
            {
                path: '/home',
                component: {
                    template: '<div>Home page</div>'
                },
            },
            {
                path: '/about',
                component: function(resolve, reject) {
                    require(['./comp7.vue'], resolve)

//                    load('comp7', 'comp7.vue').then(resolve, reject);
                }
            }
        ]
    });
    var app = new Vue({
        el: '#app',
        router: router,
    });
</script>

</body>
</html>-->
